#include "any.hpp"

using namespace std;

void t1()
{
    Any a;
    a = 10;
    int *pa = a.get<int>();
    cout << "*pa = " << *pa << endl;
    cout << "------------------------------------\n";

    Any b(a);
    int *pb = b.get<int>();
    cout << "*pb = " << *pb << endl;
    cout << "------------------------------------\n";

    Any c(6);
    int *pc = c.get<int>();
    cout << "*pc = " << *pc << endl;
    cout << "------------------------------------\n";

    string str = "hello Any";
    c = str;
    string *sc = c.get<string>();
    cout << "*sc = " << *sc << endl;
}

void t2()
{
class Test
{
public:
    Test()
    {
        cout << "Test()" << endl;
    }
    Test(const Test &t)
    {
        cout << "Test(const Test &t)" << endl;
    }
    ~Test()
    {
        cout << "~Test()" << endl;
    }
};

Any a;

{
    Test t;
    a = t;
}

cout << "--------------------\n";

}

int main()
{
    t1();
    cout << "===========================================\n";
    t2();

    return 0;
}